package 作业;

import java.util.Comparator;
import java.util.Set;
import java.util.TreeSet;

// 要求：以下代码针对Person-idCard排序(降序)，请问代码是否会报错？如果有错？如何解决？


public class Demo5 {
    public static void main(String[] args) {
        Set<Person> set = new TreeSet<>();
        set.add(new Person(154, "zhaoliu"));
        set.add(new Person(101, "zhangsan"));
        set.add(new Person(101, "zhangsan"));
        set.add(new Person(133, "wangwu"));
        set.add(new Person(115, "zhangsan"));
        set.add(new Person(115, "zhangsan"));
        set.add(new Person(112, "lisi"));
        set.forEach(System.out::println);//打印结果
    }
}